
////----------//
///**GLOBAL**///
//----------////
//-Global Defines-//

//>McFX Suite General Settings<\\
//-Commentary:The McFX Suite contains various Depth of Field, ambient occlusion and vision changing shader.\nThose shader are derived from MasterEffect.


////--------------------//
///**AMBIENTOCCLUSION**///
//--------------------////
#define USE_AMBIENTOCCLUSION 1 //[SSAO] //-Ambient Occlusion: Enables physically incorrect shading that most newer gen games use. Multiple algorithms available.

//>Global Parameters<\\
#define AO_METHOD 1 //[1:6] //-No description given
#define AO_TEXSCALE 1.00 //[0.25:1.00] //-Scale of AO resolution, 1.0 means fullscreen. Lower resolution means less pixels to process and more performance but also less quality.
#define AO_SHARPNESS 0.05 //[0.05:2.00] //-No description given
#define AO_SHARPNESS_DETECT 2 //[1:2] //-AO must not blur over object edges. 1 : edge detection by depth (old) 2 : edge detection by normal (new). 2 is better but produces some black outlines.
#define AO_BLUR_STEPS 15 //[5:15] //-Offset count for AO smoothening. Higher means more smooth AO but also blurrier AO.
#define AO_DEBUG 2 //[0:2] //-No description given
#define AO_LUMINANCE_CONSIDERATION 0 //[0:1] //-No description given
#define AO_LUMINANCE_LOWER 1.0 //[0.0:1.0] //-No description given
#define AO_LUMINANCE_UPPER 1.0 //[0.0:1.0] //-No description given
#define AO_FADE_START 0.00 //[0.00:1.00] //-Distance from camera where AO starts to fade out. 0.0 means camera itself, 1.0 means infinite distance.

//>Global Parameters<\\
#define AO_FADE_END 1.00 //[0.00:1.00] //-Distance from camera where AO fades out completely. 0.0 means camera itself, 1.0 means infinite distance.
#define AO_ToggleKey RFX_ToggleKey //[undef] //-

//>SSAO Settings<\\
#define iSSAOSamples 128 //[16:128] //-Amount of samples. Don't set too high or shader compilation time goes through the roof.
#define fSSAOSamplingRange 50.0 //[10.0:50.0] //-SSAO sampling range. High range values might need more samples so raise both.
#define fSSAODarkeningAmount 1.5 //[0.0:5.0] //-Amount of SSAO corner darkening
#define fSSAOBrighteningAmount 0.0 //[0.0:5.0] //-Amount of SSAO edge brightening

//>Raymarch AO Settings<\\
#define iRayAOSamples 78 //[10:78] //-Amount of sample "rays" Higher means more accurate AO but also less performance.
#define fRayAOSamplingRange 0.0200 //[0.0001:0.0200] //-Range of AO sampling. Higher values ignore small geometry details and shadow more globally.
#define fRayAOMaxDepth 0.20 //[0.01:0.20] //-factor to avoid far objects to occlude close objects just because they are besides each other on screen.
#define fRayAOMinDepth 0.00100 //[0.00000:0.00100] //-Minimum depth difference cutoff to prevent (almost) flat surfaces to occlude themselves.
#define fRayAOPower 5.0 //[0.2:5.0] //-Amount of darkening.

//>HBAO Settings<\\
#define iHBAOSamples 36 //[7:36] //-Amount of samples. Higher means more accurate AO but also less performance.
#define fHBAOSamplingRange 5.0 //[0.5:5.0] //-Range of HBAO sampling. Higher values ignore small geometry details and shadow more globally.
#define fHBAOAmount 10.0 //[1.0:10.0] //-Amount of HBAO shadowing.
#define fHBAOClamp 1.0 //[0.0:1.0] //-Clamps HBAO power. 0.0 means full power, 1.0 means no HBAO.
#define fHBAOAttenuation 0.200 //[0.001:0.200] //-Affects the HBAO range, prevents shadowing of very far objects which are close in screen space.

//>SSGI Settings<\\
#define iSSGISamples 24 //[5:24] //-Amount of SSGI sampling iterations, higher means better GI but less performance.
#define fSSGISamplingRange 80.0 //[0.0:80.0] //-Radius of SSGI sampling.
#define fSSGIIlluminationMult 8.0 //[1.0:8.0] //-Multiplier of SSGI illumination (color bouncing/reflection).
#define fSSGIOcclusionMult 9.5 //[0.0:10.0] //-Multiplier of SSGI occlusion.
#define fSSGIModelThickness 100.0 //[0.5:100.0] //-Amount of unit spaces the algorithm assumes the model's thickness. Lower if scene only contains small objects.
#define fSSGISaturation 2.0 //[0.2:2.0] //-Saturation of bounced/reflected colors.

//>RAYMARCH HBAO Settings<\\
#define iRayHBAO_StepCount 32 //[5:32] //-Amount of steps to march per direction to check for occluders.
#define iRayHBAO_StepDirections 25 //[5:25] //-Amount of rays / directions to march to check for occluders.
#define fRayHBAO_SampleRadius 0.001 //[0.001:0.010] //-Range of AO sampling. Higher values ignore small geometry details and shadow more globally.
#define fRayHBAO_Attenuation 5.0 //[0.4:5.0] //-Sampling attenuation. Used for ignoring objects that are close onscreen but actually far away (i.e. sky and player).
#define fRayHBAO_AngleBiasTan 1.0 //[0.0:1.0] //-Angle bias in tangent space. Used for ignoring occluders that don't have a big angle difference to the source, i.e. flat surfaces that may shadoe themselves.

//>SAO Settings<\\
#define fSAOIntensity 10.0 //[1.0:10.0] //-Linearly multiplies AO intensity.	
#define fSAOClamp 10.0 //[1.0:10.0] //-Higher values shift AO more into black. Useful for light gray AO caused by high SAO radius.
#define fSAORadius 10.0 //[1.0:10.0] //-SAO sampling radius. Higher values also lower AO intensity extremely because of Alchemy's extremely retarded falloff formula.
#define fSAOBias 0.500 //[0.001:0.500] //-Minimal surface angle for AO consideration. Useful to prevent self-occlusion of flat surfaces caused by floating point inaccuracies.
#define iSAOSamples 96 //[10:96] //-Amount of SAO Samples. Maximum of 96 is defined by formula.


////----------------//
///**DEPTHOFFIELD**///
//----------------////
#define USE_DEPTHOFFIELD 0 //[DOF] //-

//>Global Parameters<\\
#define DOF_METHOD 1 //[1:5] //-1: Ring DOF(Petka/martinsh) 2: Magic DOF 3: GP65CJ042 DOF 4: Matso DOF 5: Marty McFly Advanced DOF
#define DOF_AUTOFOCUS 0 //[0:1] //-Enables automated focus recognition based on samples around autofocus center.
#define DOF_FOCUSPOINT float2(0.5,0.5) //[0.0:1.0] //-X and Y coordinates of autofocus center. Axes start from upper left screen corner.
#define DOF_FOCUSSAMPLES 5 //[3:10] //-Amount of samples around the focus point for smoother focal plane detection.
#define DOF_FOCUSRADIUS 0.19 //[0.02:0.20] //-Radius of samples around the focus point.
#define DOF_NEARBLURCURVE 271.68 //[0.50:1000.00] //-Curve of blur closer than focal plane. Higher means less blur.
#define DOF_FARBLURCURVE 2.54 //[0.05:5.00] //-Curve of blur behind      focal plane. Higher means less blur.
#define DOF_MANUALFOCUSDEPTH 0.17 //[0.00:1.00] //-Depth of focal plane when autofocus is off. 0.0 means camera, 1.0 means infinite distance.
#define DOF_INFINITEFOCUS 0.48 //[0.01:1.00] //-Distance at which depth is considered as infinite. 1.0 is standard. Low values only produce out of focus blur when focus object is very close to the camera. Recommended for gaming.
#define DOF_BLURRADIUS 94.7 //[2.0:100.0] //-Maximal blur radius in pixels.

//>Global Parameters<\\
#define DOF_RENDERRESMULT 0.5 //[0.5:1.0] //-Scaling  factor
#define DOF_ToggleKey RFX_ToggleKey //[undef] //-

//>Ring DOF Settings<\\
#define iRingDOFSamples 19 //[5:30] //-Samples on the first ring. The other rings around have more samples
#define iRingDOFRings 6 //[1:8] //-Ring count
#define fRingDOFThreshold 2.3 //[0.5:3.0] //-Threshold for bokeh brightening. Above this value, everything gets much much brighter. 1.0 is maximum value for LDR games like GTASA, higher values work only on HDR games like Skyrim etc.
#define fRingDOFGain 27.0 //[0.1:30.0] //-Amount of brightening for pixels brighter than threshold.
#define fRingDOFBias 0.5 //[0.0:2.0] //-bokeh bias.
#define fRingDOFFringe 0.5 //[0.0:1.0] //-Amount of chromatic abberation

//>Magic DOF Settings<\\
#define iMagicDOFBlurQuality 30 //[1:30] //-Blur quality as control value over tap count. Quality 15 produces 721 taps, impossible with other DOF shaders by far, most they can do is about 150.
#define fMagicDOFColorCurve 5.6 //[1.0:10.0] //-DOF weighting curve.

//>GP65CJ042 DOF Settings<\\
#define iGPDOFQuality 7 //[0:7] //-0 = only slight gaussian farblur but no bokeh. 1-7 bokeh blur, higher means better quality of blur but less fps. 
#define bGPDOFPolygonalBokeh 1 //[0:1] //-Enables polygonal bokeh shape, e.g. POLYGON_NUM 5 means pentagonal bokeh shape. Setting this value to 0 results in circular bokeh shape.
#define iGPDOFPolygonCount 5 //[3:9] //-Controls the amount pf polygons for polygonal bokeh shape. 3 = triangular, 4 = square, 5 = pentagonal etc.	
#define fGPDOFBias 10.0 //[0.0:20.0] //-Shifts bokeh weighting to bokeh shape edge. Set to 0 for even bright bokeh shapes, raise it for darker bokeh shapes in center and brighter on edge.
#define fGPDOFBiasCurve 2.0 //[0.0:3.0] //-Power of Bokeh Bias. Raise for more defined bokeh outlining on bokeh shape edge.
#define fGPDOFBrightnessThreshold 0.5 //[0.5:2.0] //-Threshold for bokeh brightening. Above this value, everything gets much much brighter. 1.0 is maximum value for LDR games like GTASA, higher values work only on HDR games like Skyrim etc.
#define fGPDOFBrightnessMultiplier 2.0 //[0.0:2.0] //-Amount of brightening for pixels brighter than fGPDOFBrightnessThreshold.
#define fGPDOFChromaAmount 0.25 //[0.00:0.40] //-Amount of color shifting applied on blurred areas. 

//>MATSO DOF Settings<\\
#define bMatsoDOFChromaEnable 1 //[0:1] //-Enables Chromatic Abberation.
#define bMatsoDOFBokehEnable 1 //[0:1] //-Enables Bokeh weighting do define bright light spots and increase bokeh shape definiton.	
#define fMatsoDOFChromaPow 2.4 //[0.2:3.0] //-Amount of chromatic abberation color shifting.
#define fMatsoDOFBokehCurve 8.0 //[0.5:20.0] //-Bokeh curve.
#define fMatsoDOFBokehLight 0.012 //[0.000:2.000] //-Bokeh brightening factor.
#define iMatsoDOFBokehQuality 2 //[1:10] //-Blur quality as control value over tap count.
#define fMatsoDOFBokehAngle 0 //[0:360] //-Rotation angle of bokeh shape.

//>MCFLY ADVANCED DOF Settings - SHAPE<\\
#define iADOF_ShapeQuality 17 //[1:255] //-Quality level of DOF shape. Higher means more offsets taken, cleaner shape but also less performance. Compilation time stays same.
#define iADOF_ShapeVertices 5 //[3:8] //-Polygon count of bokeh shape. 4 = square, 5 = pentagon, 6 = hexagon and so on.
#define bADOF_ShapeTextureEnable 0 //[0:1] //-Enables the use of a texture overlay. Quite some performance drop.
#define iADOF_ShapeTextureSize 63 //[undef] //-Higher texture size means less performance. Higher quality integers better work with detailed shape textures. Uneven numbers recommended because even size textures have no center pixel.

//>MCFLY ADVANCED DOF Settings - SHAPE MODIFICATIONS<\\
#define fADOF_ShapeRotation 15.0 //[0.0:360.0] //-Static rotation of bokeh shape.
#define bADOF_RotAnimationEnable 0 //[0:1] //-Enables constant shape rotation in time.
#define fADOF_RotAnimationSpeed 2.0 //[0.2:5.0] //-Speed of shape rotation. Negative numbers change direction.
#define bADOF_ShapeCurvatureEnable 0 //[0:1] //-Bends edges of polygonal shape outwards (or inwards). Circular shape best with vertices > 7
#define fADOF_ShapeCurvatureAmount 0.3 //[0.0:1.0] //-Amount of edge bending. 1.0 results in circular shape. Values below 0 produce star-like shapes.
#define bADOF_ShapeApertureEnable 0 //[0:1] //-Enables deformation of bokeh shape into swirl-like aperture. You will recognize it when you try it out. Best with big bokeh shapes.
#define fADOF_ShapeApertureAmount 0.01 //[-0.05:0.05] //-Amount of deformation. Negative values mirror the effect.		
#define bADOF_ShapeAnamorphEnable 0 //[0:1] //-Lessens horizontal width of shape to simulate anamorphic bokeh shape seen in movies.
#define fADOF_ShapeAnamorphRatio 0.2 //[0.0:1.0] //-Horizontal width factor. 1.0 means 100% width, 0.0 means 0% width (bokeh shape will be vertical line).				
#define bADOF_ShapeDistortEnable 0 //[0:1] //-Deforms bokeh shape at screen borders to simulate lens distortion. Bokeh shapes at screen egdes look like an egg.

//>MCFLY ADVANCED DOF Settings - SHAPE MODIFICATIONS<\\
#define fADOF_ShapeDistortAmount 0.2 //[0.0:1.0] //-Amount of deformation.
#define bADOF_ShapeDiffusionEnable 0 //[0:1] //-Enables some fuzzyness of bokeh shape, makes it less clearly defined.
#define fADOF_ShapeDiffusionAmount 0.1 //[0.0:1.0] //-Amount of shape diffusion. High values look like the bokeh shape exploded.
#define bADOF_ShapeWeightEnable 0 //[0:1] //-Enables bokeh shape weight bias and shifts color to the shape borders.
#define fADOF_ShapeWeightCurve 4.0 //[0.5:8.0] //-Curve of shape weight bias.
#define fADOF_ShapeWeightAmount 1.0 //[0.5:8.0] //-Amount of shape weight bias.
#define fADOF_BokehCurve 8.1 //[1.0:20.0] //-Bokeh factor. Higher values produce more defined bokeh shapes for separated bright spots.

//>MCFLY ADVANCED DOF Settings - CHROMATIC ABERRATION<\\
#define bADOF_ShapeChromaEnable 1 //[0:1] //-Enables chromatic aberration at bokeh shape borders. This means 3 times more samples = less performance.
#define iADOF_ShapeChromaMode 4 //[1:6] //-Switches through the possible R G B shifts.
#define fADOF_ShapeChromaAmount 0.215 //[0.000:0.500] //-Amount of color shifting.
#define bADOF_ImageChromaEnable 0 //[0:1] //-Enables image chromatic aberration at screen corners. This one is way more complex than the shape chroma (and any other chroma on the web).
#define iADOF_ImageChromaHues 5 //[2:20] //-Amount of samples through the light spectrum to get a smooth gradient.
#define fADOF_ImageChromaCurve 1.0 //[0.5:2.0] //-Image chromatic aberration curve. Higher means less chroma at screen center areas.
#define fADOF_ImageChromaAmount 3.00 //[0.25:10.00] //-Linearly increases image chromatic aberration amount. 

//>MCFLY ADVANCED DOF Settings - POSTFX<\\
#define fADOF_SmootheningAmount 1.0 //[0.5:2.0] //-Blur multiplicator of box blur after bokeh to smoothen shape. Box blur is better than gaussian.
#define bADOF_ImageGrainEnable 0 //[0:1] //-Enables some fuzzyness in blurred areas. The more out of focus, the more grain.
#define fADOF_ImageGrainCurve 1.0 //[0.5:5.0] //-Curve of Image Grain distribution. Higher values lessen grain at moderately blurred areas.
#define fADOF_ImageGrainAmount 0.55 //[0.1:2.0] //-Linearly multiplies the amount of Image Grain applied.
#define fADOF_ImageGrainScale 1.0 //[0.5:2.0] //-Grain texture scale. Low values produce more coarse Noise.


////------------//
///**HEATHAZE**///
//------------////
#define USE_HEATHAZE 0 //[HeatHaze] //-

//>Heat Haze Settings<\\
#define fHeatHazeSpeed 1.7 //[0.5:10.0] //-Speed of heathaze waves
#define fHeatHazeOffset 20.0 //[0.5:20.0] //-Amount of image distortion caused by heathaze effect
#define fHeatHazeTextureScale 5.0 //[0.5:5.0] //-Scale of source texture, affecting the tile size. Use Heathaze debug effect for better visible effect.
#define fHeatHazeChromaAmount 0.3 //[0.0:2.0] //-Amount of color shift caused by heat haze. Linearly scales with fHeatHazeOffset.
#define bHeatHazeDebug 0 //[0:1] //-Enables raw texture output for debugging purposes. Useful for texture experiments.
#define HeatHaze_TimeOut 0 //[0:100000] //-Defined Toggle Key will activate the shader until time (in ms) runs out. "0" deactivates the timeout feature.
#define HeatHaze_ToggleKey RFX_ToggleKey //[undef] //-


////--------------//
///**FISHEYE_CA**///
//--------------////
#define USE_FISHEYE_CA 0 //[FishEyeCA] //-

//>Fish Eye Chromatic Abberation Settings<\\
#define fFisheyeZoom 0.5 //[0.5:1.0] //-some lens zoom to hide bugged edges due to texcoord modification
#define fFisheyeDistortion 0.15 //[-0.30:0.30] //-distortion of image, fish eye effect
#define fFisheyeDistortionCubic 0.15 //[-0.30:0.30] //-distortion of image, fish eye effect, cube based
#define fFisheyeColorshift -0.03 //[-0.10:0.10] //-Amount of color shifting
#define FishEye_TimeOut 0 //[0:100000] //-Defined Toggle Key will activate the shader until time (in ms) runs out. "0" deactivates the timeout feature.
#define FishEye_ToggleKey RFX_ToggleKey //[undef] //-


////-------//
///**RBM**///
//-------////
#define USE_RBM 0 //[RBM] //-

//>Reflective Bump Mapping Settings<\\
#define fReflectionWideness 150.0 //[25.0:150.0] //-Wideness of reflection in pixels.
#define fReflectionSamples 128 //[32:128] //-Amount of Reflection Samples
#define fReflectionReliefHeight 1.00 //[0.50:2.00] //-Relief Height
#define fReflectionAmount 0.81 //[0.05:1.00] //-Mix factor between bump and original color. 0.0 means no bump applied, 1.0 means pure bump source.
#define fReflectionFresnelFactor 1.00 //[0.00:1.00] //-Lowers reflections when looking at a reflecting surface at a steep angle. Factor determines how much fresnel effect is taken into account.
#define fReflectionFresnelCurve 30.0 //[1.0:30.0] //-Fresnel curve. The higher the value, the lower reflections at steep view angles are.
#define RBM_ToggleKey RFX_ToggleKey //[undef] //-

